package com.rattsoftware.server.service;

import java.util.List;

import com.rattsoftware.server.admin.model.CourseUnit;
import com.rattsoftware.server.admin.model.exceptions.RattsSecurityException;
import com.rattsoftware.server.admin.model.paging.PagingLoadConfig;
import com.rattsoftware.server.admin.model.paging.PagingLoadResult;

public interface CourseUnitService {

	/**
	 * Returns a given Course Unit given the ID.
	 * 
	 * @param courseUnitId
	 *            Id of the Course Unit to retrieve.
	 * @return Course
	 */
	CourseUnit getCourseUnit(int courseUnitId) throws RattsSecurityException;
	
	/**
	 * Deletes the courseUnit data.
	 * 
	 * @param courseUnit
	 */
	void deleteCourseUnit(CourseUnit courseUnit) throws RattsSecurityException;

	/**
	 * Deletes all the submitted data specified by the IDs 
	 * 
	 * @param courseUnitIds
	 * @throws RattsSecurityException
	 */
	void deleteCourseUnit(List<Integer> courseUnitIds) throws RattsSecurityException;
	
	/**
	 * Retrieves a page of the course unit data.
	 * 
	 * @param pagingLoadConfig
	 *            config to specify paging related config
	 * @return PagingLoadResult containing a page of course data
	 */
	PagingLoadResult<CourseUnit> getCourseUnitList( PagingLoadConfig pagingLoadConfig) throws RattsSecurityException;
	
	/**
	 * Saves a new and modified course to the database.
	 * 
	 * @param course the course to save.
	 * @return course saved with id populated
	 * @throws RattsSecurityException For any <tt>security related</tt> that occurs on the <tt>service layer.</tt>
	 */
	CourseUnit saveCourseUnit(CourseUnit courseUnit) throws RattsSecurityException;
	
	/**
	 * Persists a given list of CourseUnits to the database.
	 * 
	 * @param courseUnits List of CourseUnits to persist.
	 */
	void saveCourseUnits(List<CourseUnit> courseUnits) throws RattsSecurityException;
}
